A General Framework for Embedding Domain Specific Languages into Object-Oriented Programming Languages
نویسندگان
چکیده
In this paper, we introduce a general framework of language embedding in OO host languages. Unlike other approaches, which embed object language programs as nested calls to functions or data constructors, our framework embeds object language programs as a chain of method invocations. Our framework allows embedding a wider range of object language grammars into an OO host language, while still allowing object language programs to be type checked by the host language compiler and to run efficiently at run time. We demonstrate our framework using ELIA, our extension to Java with automatically constructed parameters (ACPs), and show how we can encode the parser, AST builder, type checker, and interpreter for the simply typed lambda calculus (STLC) in a concrete syntax without redundant brackets or commas. Our framework is only based on the basic OO features, generics, and ACPs, and do not require higher-order functions or generalized abstract data types (GADTS) in the host language. It is a generalization of our previous framework [34], which can be fully implemented in Java without ACPs.
منابع مشابه
A General Framework for Method Chaining Style Embedding of Domain Specific Languages
Embedded Domain Specific Languages(DSL) are used in various programming tasks, such as SQL in database applications and regular expressions in pattern matching. Embedding DSL programs as strings in the host language that are interpreted at runtime make it extremely difficult to statically check for errors in the embedded programs. One solution is using specialized checkers, but the programming ...
متن کاملUsing Domain Specific Languages for Modeling and Simulation: ScalaTion as a Case Study
Progress in programming paradigms and languages has over time influenced the way that simulation programs are written. Modern object-oriented, functional programming languages are expressive enough to define embedded Domain Specific Languages (DSLs). The Scala programming language is used to implement ScalaTion that supports several popular simulation modeling paradigms. As a case study, ScalaT...
متن کاملEmbedded Domain - Specific Languages using Libraries and Dynamic
Domain-specific programming is bound to play a central role in improving the productivity of writing software. This is because modern, intricate, general-purpose abstractions are rarely applicable directly to everyday programming. However, such abstractions can be used to encode domain-specific abstractions, so that the generalpurpose language serves as a host inwhich domain-specific fragments ...
متن کاملModeling and Evaluation of Stochastic Discrete-Event Systems with RayLang Formalism
In recent years, formal methods have been used as an important tool for performance evaluation and verification of a wide range of systems. In the view points of engineers and practitioners, however, there are still some major difficulties in using formal methods. In this paper, we introduce a new formal modeling language to fill the gaps between object-oriented programming languages (OOPLs) us...
متن کاملModeling and Evaluation of Stochastic Discrete-Event Systems with RayLang Formalism
In recent years, formal methods have been used as an important tool for performance evaluation and verification of a wide range of systems. In the view points of engineers and practitioners, however, there are still some major difficulties in using formal methods. In this paper, we introduce a new formal modeling language to fill the gaps between object-oriented programming languages (OOPLs) us...
متن کامل